/**
 * ```js
 * let str = '{'
 * const res = parseJson(str, {}) // {}
 * ```
 * @param s
 * @param falllback
 * @returns
 */
export function parseJson<T = any>(s: string, falllback: unknown) {
  try {
    return JSON.parse(s) as T;
  } catch (error) {
    return falllback as T;
  }
}
